package com.bitcola.security.gate.v2.service;

import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.bitcola.security.api.vo.authority.PermissionInfo;
import com.bitcola.security.gate.v2.feign.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*
 * @author:wx
 * @description:用户权限获取
 * @create:2018-07-14  23:01
 */
@Service
public class UserService {


    @Resource
    private IUserService iUserService;
//    @Cache(key = "getPermissionByUsername:{1}",expire = 1)
    @Cached(cacheType = CacheType.LOCAL,expire = 5)
    public List<PermissionInfo> getPermissionByUsername(String username){
        return iUserService.getPermissionByUsername(username);

    }
//    @Cache(key = "getAllPermissionInfo",expire = 1)
@Cached(cacheType = CacheType.LOCAL,expire = 5)

public List<PermissionInfo> getAllPermissionInfo(){
        return iUserService.getAllPermissionInfo();


    }

}
